//
//  FortuneViewController.m
//  Contractor
//
//  Created by star j on 16/4/18.
//  Copyright © 2016年 star j. All rights reserved.
//

#import "FortuneViewController.h"
#import "AFHTTPRequestOperationManager.h"
#import "CodeWithDES.h"
#import "ModelFortune.h"
#import "ModelContent.h"
#import "FortuneDetailViewController.h"
#import "NoticeViewController.h"
#import "RZViewController.h"
#import "CONST.h"

@interface FortuneViewController ()
{
    ModelFortune *modelfortune ;
    ModelContent *modelcontent ;
    UIView *nowAmountBackview ;
    UIView *undoneAmountBackview ;
    UIView *currentmonthgBackview ;
    UIView *totalBackview ;
    UIView *noRZView ;
    UIView *backGroundView ;
}

@end

@implementation FortuneViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.view.backgroundColor = [UIColor whiteColor] ;
//    self.extendedLayoutIncludesOpaqueBars = NO;
//    self.edgesForExtendedLayout = UIRectEdgeBottom | UIRectEdgeLeft | UIRectEdgeRight;
    modelfortune = [[ModelFortune alloc] init] ;
    modelcontent = [[ModelContent alloc] init] ;
//    [self userRz] ;
    [self createNavbar] ;
    
}

- (void)viewWillAppear:(BOOL)animated
{
    [self userRz] ;
//    [self downloadData] ;
  //  [self createNavbar] ;
}

//- (void)viewDidAppear:(BOOL)animated
//{
//    [self userRz] ;
//}

#pragma mark - Navgationbar
- (void)createNavbar
{
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
    
    btn.frame =CGRectMake(0, 0, 30, 20);
    
    [btn setBackgroundImage:[UIImage imageNamed:@"email_normal_icon.png"] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(notice) forControlEvents:UIControlEventTouchUpInside] ;
    
    UIBarButtonItem *noticeItem = [[UIBarButtonItem alloc] initWithCustomView:btn] ;
    
    self.navigationItem.rightBarButtonItem = noticeItem ;
}

- (void)notice
{
    NoticeViewController *vc = [[NoticeViewController alloc] init] ;
    self.hidesBottomBarWhenPushed = YES ;
    [self.navigationController pushViewController:vc animated:NO] ;
    self.hidesBottomBarWhenPushed = NO ;
}


#pragma mark - CreateView
- (void)createView
{
    backGroundView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, __kScreenWidth, self.view.frame.size.height)] ;
    [self.view addSubview:backGroundView] ;
    
    //当前余额背景图
    nowAmountBackview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, __kScreenWidth, 70)] ;
    nowAmountBackview.backgroundColor = [UIColor whiteColor] ;
    nowAmountBackview.userInteractionEnabled = YES ;
    UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer
                                                     alloc] initWithTarget:self action:@selector(pushVC)];
    tapGestureRecognizer.numberOfTapsRequired = 1;
    [nowAmountBackview addGestureRecognizer: tapGestureRecognizer];
    [backGroundView addSubview:nowAmountBackview] ;
    
    //余额label
    UILabel *nowtitleLabel = [[UILabel alloc] init] ;
    nowtitleLabel.text = @"当前余额" ;

    nowtitleLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:16.0f] ;
    CGSize titleLength = [self lengthwithLabel:nowtitleLabel withsize:16.0f] ;
    nowtitleLabel.frame = CGRectMake(10, 16, titleLength.width, 18.0f) ;
    nowtitleLabel.textColor = [UIColor blackColor] ;
    [nowAmountBackview addSubview:nowtitleLabel] ;
    
    UIImageView *nextView = [[UIImageView alloc] initWithFrame:CGRectMake(__kScreenWidth-40, 17.5 , 25, 35)] ;
    [nextView setImage:[UIImage imageNamed:@"page_access_next_icon.png"]] ;
    [nowAmountBackview addSubview:nextView] ;
    
    //未完成view
    undoneAmountBackview = [[UIView alloc] initWithFrame:CGRectMake(0, nowAmountBackview.frame.origin.y + nowAmountBackview.frame.size.height, __kScreenWidth, 50)] ;
    undoneAmountBackview.backgroundColor = [UIColor whiteColor] ;
    [backGroundView addSubview:undoneAmountBackview] ;
    
    //未完成label
    UILabel *undoneLabel = [[UILabel alloc] init] ;
    undoneLabel.text = @"未完成工单余额" ;
    undoneLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:16.0f] ;
    CGSize undoneLength = [self lengthwithLabel:undoneLabel withsize:16.0f] ;
    undoneLabel.frame = CGRectMake(10, 16, undoneLength.width, 18.0f) ;
    [undoneAmountBackview addSubview:undoneLabel] ;
    
    //本月view
    currentmonthgBackview = [[UIView alloc] initWithFrame:CGRectMake(0, undoneAmountBackview.frame.origin.y + undoneAmountBackview.frame.size.height, __kScreenWidth, 70)] ;
    currentmonthgBackview.backgroundColor = [UIColor whiteColor] ;
    [backGroundView addSubview:currentmonthgBackview] ;
    
    //本月label
    UILabel *currentLabel = [[UILabel alloc] init] ;
    currentLabel.text = @"本月情况" ;
    currentLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:16.0f] ;
    currentLabel.frame = CGRectMake(10, 26, titleLength.width, 18.0f) ;
    
    
    [currentmonthgBackview addSubview:currentLabel] ;
    
    //完成工单
    UILabel *completeLabel = [[UILabel alloc] init] ;
    completeLabel.text = @"完成工单" ;
    completeLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:14.0f] ;
    CGSize completeLength = [self lengthwithLabel:completeLabel withsize:14.0f] ;
    completeLabel.frame = CGRectMake(__kScreenWidth/2.0 - completeLength.width, currentmonthgBackview.frame.size.height-20.0f, completeLength.width, 16.0f) ;
    [currentmonthgBackview addSubview:completeLabel] ;
    
    //金额
    UILabel *amountLabel = [[UILabel alloc] init] ;
    amountLabel.text = @"金额" ;
    amountLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:14.0f] ;
    CGSize amountLength = [self lengthwithLabel:amountLabel withsize:14.0f] ;
    amountLabel.frame = CGRectMake(__kScreenWidth/2.0 + 20, currentmonthgBackview.frame.size.height-20.0f, amountLength.width, 16.0f) ;
    [currentmonthgBackview addSubview:amountLabel] ;
    
    //评价
    UILabel *assessmentLabel = [[UILabel alloc] init] ;
    assessmentLabel.text = @"评价" ;
    assessmentLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:14.0f] ;
    CGSize assessmentLength = [self lengthwithLabel:assessmentLabel withsize:14.0f] ;
    assessmentLabel.frame = CGRectMake(__kScreenWidth - assessmentLength.width - 40, currentmonthgBackview.frame.size.height-20.0f, assessmentLength.width, 16.0f) ;
    [currentmonthgBackview addSubview:assessmentLabel] ;
    
    //累计view
    totalBackview = [[UIView alloc] initWithFrame:CGRectMake(0, currentmonthgBackview.frame.origin.y + currentmonthgBackview.frame.size.height, __kScreenWidth, 70)] ;
    [backGroundView addSubview:totalBackview] ;
    
    //累计label
    UILabel *totleLabel = [[UILabel alloc] init] ;
    totleLabel.text = @"累计情况" ;
    totleLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:16.0f] ;
    totleLabel.frame = CGRectMake(10, 26, titleLength.width, 18.0f) ;
    
    [totalBackview addSubview:totleLabel] ;
    
    //完成工单1
    UILabel *completeLabel1 = [[UILabel alloc] init] ;
    completeLabel1.text = @"完成工单" ;
    completeLabel1.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:14.0f] ;
    CGSize completeLength1 = [self lengthwithLabel:completeLabel1 withsize:14.0f] ;
    completeLabel1.frame = CGRectMake((__kScreenWidth - completeLength1.width)/2, currentmonthgBackview.frame.size.height-20.0f, completeLength1.width, 16.0f) ;
    [totalBackview addSubview:completeLabel1] ;

    //评价1
    UILabel *assessmentLabel1 = [[UILabel alloc] init] ;
    assessmentLabel1.text = @"评价" ;
    assessmentLabel1.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:14.0f] ;
    CGSize assessmentLength1 = [self lengthwithLabel:assessmentLabel1 withsize:14.0f] ;
    assessmentLabel1.frame = CGRectMake(__kScreenWidth - assessmentLength1.width - 40, currentmonthgBackview.frame.size.height-20.0f, assessmentLength1.width, 16.0f) ;
    [totalBackview addSubview:assessmentLabel1] ;
    
    
    UIImageView *lineView = [[UIImageView alloc] initWithFrame:CGRectMake(0, undoneAmountBackview.frame.origin.y, __kScreenWidth, 0.5) ];
    [lineView setImage:[UIImage imageNamed:@"layout_small_line_bg.png"]] ;
    [backGroundView addSubview:lineView] ;
    
    UIImageView *lineView1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, totalBackview.frame.origin.y + totalBackview.frame.size.height, __kScreenWidth, 0.5) ];
    [lineView1 setImage:[UIImage imageNamed:@"layout_small_line_bg.png"]] ;
    [backGroundView addSubview:lineView1] ;
    
    UIImageView *pressView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, __kScreenWidth, 10)] ;
    [pressView setImage:[UIImage imageNamed:@"press_bg.jpg"]] ;
    UIImageView *pressView1 = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, __kScreenWidth, 10)] ;
    [pressView1 setImage:[UIImage imageNamed:@"press_bg.jpg"]] ;
    [currentmonthgBackview addSubview:pressView] ;
    [totalBackview addSubview:pressView1] ;
    
}

#pragma mark - 创建数字label
- (void)creatNumLabel
{
    //当前余额
    UILabel *nowNumLabel = [[UILabel alloc] init] ;
    nowNumLabel.text = [NSString stringWithFormat:@"%@",modelfortune.totalamount] ;
    
    NSLog(@"nowNumLabel.text:%@",nowNumLabel.text) ;
    
    nowNumLabel.textColor = [UIColor orangeColor] ;
    nowNumLabel.font = [UIFont fontWithName:@"AvenirLTStd-Medium" size:28.0f];
    CGSize nowNumLength = [self lengthwithLabel:nowNumLabel withsize:28.0f] ;
    
    UILabel *nowWordLabel = [[UILabel alloc] init] ;
    nowWordLabel.text = @"元" ;
    nowWordLabel.textColor = [UIColor orangeColor] ;
    nowWordLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:16.0f];
    CGSize nowWordLength = [self lengthwithLabel:nowWordLabel withsize:16.0f] ;
    
    nowNumLabel.frame = CGRectMake((__kScreenWidth - nowNumLength.width -nowWordLength.width-16)/2, (nowAmountBackview.frame.size.height-28.0f)/2, nowNumLength.width+10, 30.0f) ;
    
    nowWordLabel.frame = CGRectMake(nowNumLabel.frame.origin.x+nowNumLabel.frame.size.width+6, nowNumLabel.frame.origin.y+6, nowWordLength.width, 18.0f) ;
    [nowAmountBackview addSubview:nowNumLabel] ;
    [nowAmountBackview addSubview:nowWordLabel] ;
    
    //未完成工单金额
    UILabel *undoneLabel = [[UILabel alloc] init] ;
    undoneLabel.text = [NSString stringWithFormat:@"￥%@",modelfortune.totalundoneamount] ;
    undoneLabel.textColor = [UIColor orangeColor] ;
    undoneLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:16.0f] ;
    CGSize undoneLength = [self lengthwithLabel:undoneLabel withsize:16.0f] ;
    undoneLabel.frame = CGRectMake(__kScreenWidth - undoneLength.width - 20, 16, undoneLength.width, 18.0f) ;
    [undoneAmountBackview addSubview:undoneLabel] ;
    
    //本月完成工单量
    NSString *text = @"完成工单" ;
    NSDictionary *attribute1 = @{NSFontAttributeName: [UIFont fontWithName:@"AvenirLTStd-Light" size:14.0f]};
    CGSize DescSize = [text boundingRectWithSize:CGSizeMake(MAXFLOAT, 14.0f) options: NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attribute1 context:nil].size;
    
    UILabel *completeLabel = [[UILabel alloc] init] ;
    completeLabel.text =  [NSString stringWithFormat:@"%ld",(long)modelfortune.currentmonthgddone] ;
    completeLabel.textColor = [UIColor orangeColor] ;
    completeLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:14.0f] ;
    completeLabel.frame = CGRectMake(__kScreenWidth/2 - DescSize.width, currentmonthgBackview.frame.size.height-46.0f, DescSize.width, 16.0f) ;
    completeLabel.textAlignment = NSTextAlignmentCenter ;
    [currentmonthgBackview addSubview:completeLabel] ;
    
    //本月金额
    NSString *text1 = @"金额" ;
    NSDictionary *attribute = @{NSFontAttributeName: [UIFont fontWithName:@"AvenirLTStd-Light" size:14.0f]};
    CGSize DescSize1 = [text1 boundingRectWithSize:CGSizeMake(MAXFLOAT, 14.0f) options: NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attribute context:nil].size;
    
    UILabel *amountLabel = [[UILabel alloc] init] ;
    amountLabel.text = [NSString stringWithFormat:@"￥%@",modelfortune.currentmonthgddoneamount] ;
    amountLabel.textColor = [UIColor orangeColor] ;
    amountLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:14.0f] ;
    amountLabel.frame = CGRectMake(__kScreenWidth/2 , currentmonthgBackview.frame.size.height-46.0f, DescSize1.width + 40, 16.0f) ;
    amountLabel.textAlignment = NSTextAlignmentCenter ;
    [currentmonthgBackview addSubview:amountLabel] ;
    
    //总完成工单量
    UILabel *completeLabel1 = [[UILabel alloc] init] ;
    completeLabel1.text = [NSString stringWithFormat:@"%ld",(long)modelfortune.totalmonthgddone] ;
    completeLabel1.textColor = [UIColor orangeColor] ;
    completeLabel1.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:16.0f] ;
    CGSize completeLength1 = [self lengthwithLabel:completeLabel1 withsize:16.0f] ;
    completeLabel1.frame = CGRectMake((__kScreenWidth - completeLength1.width)/2, currentmonthgBackview.frame.size.height-46.0f, completeLength1.width, 18.0f) ;
    [totalBackview addSubview:completeLabel1] ;
    
    [self commentsStar:modelfortune.currentmonthgddonecomments inView:currentmonthgBackview] ;
    [self commentsStar:modelfortune.totalmonthgddonecomments inView:totalBackview] ;
    /*
    UILabel *totleLabel = [[UILabel alloc] init] ;
    totleLabel.text = @"累计情况" ;
    totleLabel.font = [UIFont fontWithName:@"AvenirLTStd-Light" size:16.0f] ;
    totleLabel.frame = CGRectMake(10, 26, titleLength.width, 18.0f) ;
    
    [totalBackview addSubview:totleLabel] ;
     
     
     */
}

#pragma mark - 评价星星
- (void)commentsStar:(NSInteger) starNum inView:(UIView *)backView
{
    for (NSInteger i = 0; i < starNum; i++) {
        UIImageView *starImage = [[UIImageView alloc] initWithFrame:CGRectMake(__kScreenWidth-15*(5-i)-15, currentmonthgBackview.frame.size.height-46.0f, 15, 15)] ;
        [starImage setImage:[UIImage imageNamed:@"ratingbar_progress_icon.png"]] ;
        [backView addSubview:starImage] ;
    }
    NSInteger remainderNum = 5 - starNum ;
    for (NSInteger i = 0; i < remainderNum; i++) {
        UIImageView *starImage = [[UIImageView alloc] initWithFrame:CGRectMake(__kScreenWidth-15*(5-starNum-i)-15, currentmonthgBackview.frame.size.height-46.0f, 15, 15)] ;
        [starImage setImage:[UIImage imageNamed:@"ratingbar_background_icon.png"]] ;
        [backView addSubview:starImage] ;
    }
}

#pragma mark - 没认证状态view
- (void)creatNoRZView
{
    noRZView = [[UIView alloc] initWithFrame:self.view.frame] ;
    noRZView.backgroundColor = [UIColor whiteColor] ;
    [self.view addSubview:noRZView] ;
    UITextView *RZtextView = [[UITextView alloc] initWithFrame:CGRectMake(50, (self.view.frame.size.height - 240) / 2, __kScreenWidth - 100, 50)] ;
    RZtextView.text = @"您还尚未认证，需要认证后才能绑定服务商" ;
    RZtextView.textAlignment = NSTextAlignmentCenter ;
    RZtextView.textColor = [UIColor blackColor] ;
    RZtextView.font = [UIFont systemFontOfSize:16.0f] ;
    RZtextView.editable = NO ;
    [noRZView addSubview:RZtextView] ;
    
    UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom] ;
    btn.frame = CGRectMake((__kScreenWidth - 150) / 2, RZtextView.frame.origin.y + RZtextView.frame.size.height + 10, 150, 40) ;
    [btn setBackgroundImage:[UIImage imageNamed:@"about_szn_service_protocol_normal_btn.png"] forState:UIControlStateNormal] ;
    [btn setTitle:@"申请认证" forState:UIControlStateNormal] ;
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal] ;
    [btn addTarget:self action:@selector(pushRzVC) forControlEvents:UIControlEventTouchUpInside] ;
    [noRZView addSubview:btn] ;
}

//申请认证
- (void)pushRzVC
{
    RZViewController *vc = [[RZViewController alloc] init] ;
    self.hidesBottomBarWhenPushed = YES ;
    [self.navigationController pushViewController:vc animated:NO] ;
    self.hidesBottomBarWhenPushed = NO ;
}


#pragma mark - 详情页跳转
- (void)pushVC
{
    FortuneDetailViewController *vc = [[FortuneDetailViewController alloc] init] ;
    vc.detailModel = modelfortune ;
    self.hidesBottomBarWhenPushed = YES ;
    [self.navigationController pushViewController:vc animated:NO] ;
    self.hidesBottomBarWhenPushed = NO ;
}

- (CGSize)lengthwithLabel:(UILabel *)lable withsize:(CGFloat) size
{
    NSDictionary *attribute1 = @{NSFontAttributeName: [UIFont fontWithName:@"AvenirLTStd-Light" size:size]};
    CGSize DescSize = [lable.text boundingRectWithSize:CGSizeMake(MAXFLOAT, size) options: NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading attributes:attribute1 context:nil].size;
    return DescSize ;
}


#pragma mark - 加载数据
- (void)downloadData
{
    NSUserDefaults *uidDefaults = [NSUserDefaults standardUserDefaults] ;
    NSInteger uidInt = [[uidDefaults valueForKey:@"uid"] integerValue] ;
    
    NSNumber *cmd = [[NSNumber alloc] initWithInt:7] ;
    NSNumber *uid = [[NSNumber alloc] initWithInteger:uidInt] ;
    NSDictionary *parameters = @{@"cmd":cmd,@"uid":uid};
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    [manager POST:getAppJson parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject)
     {
         //解密并解析json数据，将json转成字典
         NSString *decodeStr = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding] ;
         decodeStr = [CodeWithDES decodeWithStr:decodeStr] ;
         NSLog(@"decodeStr:%@",decodeStr) ;
         NSData *decodeData = [decodeStr dataUsingEncoding:NSUTF8StringEncoding] ;
         id result = [NSJSONSerialization JSONObjectWithData:decodeData options:NSJSONReadingMutableContainers error:nil] ;
         //获取字典中的值
         if ([result isKindOfClass:[NSDictionary class]])
         {
             NSDictionary *dic = result ;
             NSLog(@"dic:%@",dic) ;
             if ([dic[@"status"] integerValue] == 1)
             {
                 [modelfortune setValuesForKeysWithDictionary:dic] ;
                 [self creatNumLabel] ;
             }
             
         }
     }
          failure:^(AFHTTPRequestOperation *operation, NSError *error)
     {
         NSLog(@"Error: %@", error);
     }];
}

- (void)userRz
{
    [backGroundView removeFromSuperview] ;
    [noRZView removeFromSuperview] ;
    NSUserDefaults *uidDefaults = [NSUserDefaults standardUserDefaults] ;
    NSInteger uidInt = [[uidDefaults valueForKey:@"uid"] integerValue] ;
    
    NSNumber *cmd = [[NSNumber alloc] initWithInt:304] ;
    NSNumber *uid = [[NSNumber alloc] initWithInteger:uidInt] ;
    NSDictionary *parameters = @{@"cmd":cmd,@"uid":uid};
    
    AFHTTPRequestOperationManager *manager = [AFHTTPRequestOperationManager manager];
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];
    [manager POST:getAppJson parameters:parameters success:^(AFHTTPRequestOperation *operation, id responseObject)
     {
         //解密并解析json数据，将json转成字典
         NSString *decodeStr = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding] ;
         decodeStr = [CodeWithDES decodeWithStr:decodeStr] ;
         NSLog(@"rzStr:%@",decodeStr) ;
         NSData *decodeData = [decodeStr dataUsingEncoding:NSUTF8StringEncoding] ;
         id result = [NSJSONSerialization JSONObjectWithData:decodeData options:NSJSONReadingMutableContainers error:nil] ;
         //获取字典中的值
         if ([result isKindOfClass:[NSDictionary class]])
         {
             NSDictionary *dic = result ;
             // NSLog(@"dic:%@",dic) ;
             if ([dic[@"status"] integerValue] == 1)
             {
                 if ([dic[@"userrz"] integerValue] == 1) {
                     [noRZView removeFromSuperview] ;
                     [self createView] ;
                     [self downloadData] ;
                     NSLog(@"dicRZ:%@",dic) ;
                 }
                 else{
                     [self creatNoRZView] ;
                 }
                 
             }
             
         }
     }
          failure:^(AFHTTPRequestOperation *operation, NSError *error)
     {
         NSLog(@"Error: %@", error);
     }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
